package system;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import algorithm.Sportscredit_ranking;
import bean.Sports_record;
import bean.Sports_recordList;

public class Sports_rank extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		Sportscredit_ranking sportscredit_ranking = new Sportscredit_ranking();
		Map<String,List<Sports_record>> map_splist = sportscredit_ranking.Get_Ranking(Sports_recordList.getSports_records());
		
		request.setAttribute("basketball_list", map_splist.get("basketball"));
		request.setAttribute("swimming_list", map_splist.get("swimming"));
		request.setAttribute("running_list", map_splist.get("running"));
		
		request.getRequestDispatcher("/billboard.jsp").forward(request, response);
		
		
		
	}

}
